package com.specialized.coupon.service.impl;

import java.util.List;
        import com.specialized.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.specialized.coupon.mapper.CouponsMapper;
import com.specialized.coupon.domain.Coupons;
import com.specialized.coupon.service.ICouponsService;

/**
 * 个人优惠券Service业务层处理
 *
 * @author djh
 * @date 2024-07-30
 */
@Service
public class CouponsServiceImpl implements ICouponsService {
    @Autowired
    private CouponsMapper couponsMapper;

    /**
     * 查询个人优惠券
     *
     * @param userCouponId 个人优惠券主键
     * @return 个人优惠券
     */
    @Override
    public Coupons selectCouponsByUserCouponId(Long userCouponId) {
        return couponsMapper.selectCouponsByUserCouponId(userCouponId);
    }

    /**
     * 查询个人优惠券列表
     *
     * @param coupons 个人优惠券
     * @return 个人优惠券
     */
    @Override
    public List<Coupons> selectCouponsList(Coupons coupons) {
        return couponsMapper.selectCouponsList(coupons);
    }

    /**
     * 新增个人优惠券
     *
     * @param coupons 个人优惠券
     * @return 结果
     */
    @Override
    public int insertCoupons(Coupons coupons) {
                coupons.setCreateTime(DateUtils.getNowDate());
            return couponsMapper.insertCoupons(coupons);
    }

    /**
     * 修改个人优惠券
     *
     * @param coupons 个人优惠券
     * @return 结果
     */
    @Override
    public int updateCoupons(Coupons coupons) {
                coupons.setUpdateTime(DateUtils.getNowDate());
        return couponsMapper.updateCoupons(coupons);
    }

    /**
     * 批量删除个人优惠券
     *
     * @param userCouponIds 需要删除的个人优惠券主键
     * @return 结果
     */
    @Override
    public int deleteCouponsByUserCouponIds(Long[] userCouponIds) {
        return couponsMapper.deleteCouponsByUserCouponIds(userCouponIds);
    }

    /**
     * 删除个人优惠券信息
     *
     * @param userCouponId 个人优惠券主键
     * @return 结果
     */
    @Override
    public int deleteCouponsByUserCouponId(Long userCouponId) {
        return couponsMapper.deleteCouponsByUserCouponId(userCouponId);
    }
}
